//
//  YFUserStatusAndTypeTool.m
//  QuanJieShopProject
//
//  Created by apple on 2018/4/28.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "YFUserStatusAndTypeTool.h"

@implementation YFUserStatusAndTypeTool
+ (void)fetchUserStatus:(YFUserStatusAndTypeBlock)result {
    
    
    [WWNetRequest fetchUserTypeWithParameters:nil success:^(id response) {

        NSDictionary *data = response[@"data"];
        
//        NSLog(@"用户状态 response = %@", response);
        NSNumber *state = data[@"status"];
        NSNumber *user_type = data[@"user_type"];
//        NSLog(@"state = %@", state);
//        NSLog(@"user_type = %@", user_type);

        result([state intValue],[user_type intValue]);

    } failure:^(NSDictionary *error) {
        
        
        NSLog(@"error = %@", error);
       
        NSDictionary *response = error;
        if (![response isKindOfClass:[NSDictionary class]]) {
            return;
        }

        NSDictionary *data = [response objectForKey:@"data"];
        if ([data isKindOfClass:[NSDictionary class]]) {
            
            NSNumber *state = data[@"status"];
            NSNumber *user_type = data[@"user_type"];
            result([state intValue],[user_type intValue]);
        }

    }];
    
}
@end
